//
// Created by Administrator on 2023/11/24.
//
#include "bits/stdc++.h"
using namespace std;

int main(){
    string s;
    while(cin >> s)
    {
        int n = s.size();
        map<string, int> cnt;//map已经维护了字典序

        for(int i = 0; i < n; i ++) //子串头
            for(int j = 1; j <= n-i; j ++) //子串长度
                cnt[s.substr(i,j)] ++;


        for(auto t : cnt)
        {
            if(t.second <= 1) continue;
            cout << t.first << ' ' << t.second << endl;
        }
    }




}